﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace TLD_Vision.OCR
{
    public class CharacterCreator
    {
        public static Bitmap CreateCharacterBitmap(String font, char c)
        {
			Font f = new Font(font, 40);
			String character = new String(c, 1);

			Bitmap b = new Bitmap(200, 200);
			Graphics g = Graphics.FromImage(b);
			g.FillRectangle(Brushes.White, new Rectangle(0, 0, 200, 200));
			g.DrawString(character, f, Brushes.Black, new PointF(0, 0));
			g.Dispose();

			Image newImage = new Image(b);
			Rectangle rect = newImage.FindCharacterRectangle(2);

			return newImage.Crop(rect).Resize(50, 50,rect).GetBitmap();
        }
    }
}
